<template>
  <div>
      <h2>学校名称：{{name}}</h2>
      <h2>学校地址：{{address}}</h2>
      <button @click="getSchoolName">点我给App组件发送学校名</button>
  </div>
</template>

<script>
export default {
    data(){
        return {
            name:'尚硅谷',
            address:'北京昌平'
        }
    },
    props:['getScName'],
    methods: {
        getSchoolName(){
            this.getScName(this.name)
        }
    },
}
</script>

<style scoped>
    div{
        border: 3px solid rgb(71, 71, 71);
        box-shadow: 5px 5px 10px black;
        background-color:cadetblue;
    }
    button{
        border: 3px solid rgb(71, 71, 71);
        background-color: seashell;
    }
    button:hover{
        cursor: pointer;
        background-color:lightsteelblue;
    }
</style>